package com.hqyj.javaSpringBoot.modules.common.controller;

import com.hqyj.javaSpringBoot.modules.common.entity.Result;
import com.hqyj.javaSpringBoot.modules.common.service.ImageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @Description：ImageController
 * @Author ：Cwd
 * @Date ：2021/8/24 9:54
 */
@RestController
@RequestMapping("/api")
public class ImageController {

    @Autowired
    private ImageService imageService;

    /**
     * 127.0.0.1:8083/api/image/profile-big ---- post
     * @param file
     * @param imageType
     * @return
     */
    @PostMapping(value = "/image/{imageType}",consumes = "multipart/form-data")
    public Result<String> unloadImage(@RequestParam MultipartFile file,
                                      @PathVariable String imageType) {
        return imageService.unloadImage(file,imageType);
    }
}
